function login_form_con() {


    var mobile = document.getElementById("L_phone").value;  // 提取邮箱或手机号
    var pwd = document.getElementById("L_pass").value;  // 提取密码


    if (!mobile) {
        alert("请输入手机号");
        $("#register-mobile-err").show();
        return;
    }
    if (!pwd) {
        alert("请输入密码");
        $("#register-sms-code-err").show();
        return;
    }
    // 发起登录请求
    var params = {
        "phone": mobile,
        "password": pwd,

    };
    $.ajax({
        url: "/login/",
        type: "post",
        // data: params,
        data: JSON.stringify(params),
        contentType: "application/json",
        success: function (resp) {
            if (resp.code == "0") {
                // 刷新当前界面
                alert(resp.errmsg);
                location.href = "/"
            } else {
                alert(resp.errmsg);
            }
        }
    })
}

function register_form_con() {


    var name = document.getElementById("L_name").value;
    var mobile = document.getElementById("L_phone").value;  // 提取邮箱或手机号
    var pwd = document.getElementById("L_pass").value;
    var pwd2 = document.getElementById("L_pass2").value;  // 提取密码


    if (!mobile) {
        alert("请输入手机号");
        $("#register-mobile-err").show();
        return;
    }
    if (!name) {
        alert("请输入用户名");
        $("#register-mobile-err").show();
        return;
    }
    if (!pwd) {
        alert("请输入密码");
        $("#register-sms-code-err").show();
        return;
    }
    if (!pwd2) {
        alert("请输入确认密码");
        $("#register-sms-code-err").show();
        return;
    }
    // 发起登录请求
    var params = {
        'name':name,
        "phone": mobile,
        "password": pwd,
        "password2": pwd2,

    };
    $.ajax({
        url: "/register/",
        type: "post",
        // data: params,
        data: JSON.stringify(params),
        contentType: "application/json",
        success: function (resp) {
            if (resp.code == "0") {
                // 刷新当前界面
                alert(resp.errmsg);
                location.href = "/login"
            } else {
                alert(resp.errmsg);
            }
        }
    })
}